const express = require('express')
const app = express();
const http = require('http').Server(app)
const io = require('socket.io')(http)
const exphbs = require('express-handlebars')


app.engine('.hbs', exphbs({ extname: '.hbs' }));
app.set('view engine', '.hbs');

app.use('/s', express.static(__dirname + '/src'))

app.get('/', function(req, res) {
    res.render('index', {
        title: '我的老天爷',
        list: [{ name: '水电费' }, { name: '水电费是' }, { name: '阿斯蒂芬' }, { name: '玩儿' }, { name: '程序' }]
    });
});

app.get('/file', function(req, res) {
    res.render('upload');
});

app.get('/arr', function(req, res) {
    res.render('arraybuffer');
});


app.post('/upload', function(req, res) {
    console.log(1);
    res.send({ ele: true })
});








function listen() {
    app.listen('3300')
    console.log('Express app started on port 3300')
}

listen()